package concurrency.chapter6;

public class ThreadCloseForce {
    private static class Worker extends Thread{
        private boolean flag = true;
        @Override
        public void run() {
            while (flag){
                //耗时很长没机会去改变flag

            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Worker worker=new Worker();
        worker.start();
        Thread.sleep(4000);
        worker.interrupt();

    }

}
